from django.contrib import admin
from shareAPI.models import Type, Score, IndexInfo, QingHuiType, QItem, Questions, RandomUserInfo

# Register your models here.
# admin.site.register(models.Type)
admin.site.register(QingHuiType)

admin.site.register(QItem)


#Blog模型的管理器
@admin.register(IndexInfo)
class IndexInfoAdmin(admin.ModelAdmin):
    list_display=('GongGao',)
    # list_per_page设置每页显示多少条记录，默认是100条
    list_per_page = 20

#Blog模型的管理器
@admin.register(Type)
class TypeAdmin(admin.ModelAdmin):
    list_display=('typeid', 'typename')
    # list_per_page设置每页显示多少条记录，默认是100条
    list_per_page = 20

@admin.register(Score)
class ScoreAdmin(admin.ModelAdmin):
    list_display=('fenxiangid','fenxiangname','fenxiangusername','itemweight','scoreNeed','statues','ifShowIndex','clickNum')
    # list_display=('__str__',)

    # list_per_page设置每页显示多少条记录，默认是100条
    list_per_page = 20
    # ordering设置默认排序字段，负号表示降序排序
    ordering = ('-itemweight',)
    # list_editable = ['fenxiangusername', 'fenxiangname']
    # fk_fields 设置显示外键字段
    fk_fields = ('score_type',)
    # 筛选器
    list_filter = ('score_type',)  # 过滤器
    search_fields = ('itemweight', 'itemweight', 'itemweight')  # 搜索字段
    date_hierarchy = 'fenxiangdata'  # 详细时间分层筛选
    list_display_links = ['fenxiangname','fenxiangusername','itemweight',]  # 默认可编辑字段


#随机返回假的用户名和头像模型的管理器
@admin.register(RandomUserInfo)
class RandomUserInfoAdmin(admin.ModelAdmin):
    list_display=('id','userName')
    # list_per_page设置每页显示多少条记录，默认是100条
    list_per_page = 20


#随机返回假的用户名和头像模型的管理器
@admin.register(Questions)
class QuestionsAdmin(admin.ModelAdmin):
    list_display=('id','title')
    # list_per_page设置每页显示多少条记录，默认是100条
    list_per_page = 20